/*
 * FileInputNodeProperties.h
 *
 *  Created on: 9 May 2014
 *      Author: jozwika
 */

#ifndef FILEINPUTNODE_H_
#define FILEINPUTNODE_H_

namespace inte {

class FileInputNode {
public:
	FileInputNode();
	virtual ~FileInputNode();

	//const Description& getDescription() const;
	//void setDescription(const Description& description);
	enum SuccessAction
	{
		DeleteOnSuccess,
		Archive,	//Move to Atchive Subdirectory (inte_archive)
		TimeArchive	//Add Time Stamp and Move to Atchive Subdirectory (inte_archive)
	};
	enum Retry
	{
		Failure,
		Short,		//Short Retry
		ShortLong	//Short and Long Retry
	};
	enum FailureAction
	{
		Backup,		//Move to Backup Subdirectory (inte_backup)
		DeleteOnFailure,
		TimeBackup	//Add Time Stamp and Move to Backup Subdirectory (inte_backup)
	};
	enum RecordDetection
	{
		WholeFile,
		FixedLength,
		Delimited

	};
	enum Delimiter
	{
		LineEnd,	//DOS or UNIX line end
		Custom		//Custom delimiter (Hexadecimal)

	};
	enum DelimiterType
	{
		Postfix,	//
		Infix		//

	};
	enum AdditionalInstancesPool
	{
		MessageFlow,	//Use Pool Associated witch Message Flow
		Node			//Use Pool Associated witch Node

	};

	int getAdditionalInstances() const {
		return additionalInstances;
	}

	void setAdditionalInstances(int additionalInstances = 0) {
		this->additionalInstances = additionalInstances;
	}

	AdditionalInstancesPool getAdditionalInstancesPool() const {
		return additionalInstancesPool;
	}

	void setAdditionalInstancesPool(
			AdditionalInstancesPool additionalInstancesPool = MessageFlow) {
		this->additionalInstancesPool = additionalInstancesPool;
	}

	const std::string& getCustomDelimiter() const {
		return customDelimiter;
	}

	void setCustomDelimiter(const std::string& customDelimiter) {
		this->customDelimiter = customDelimiter;
	}

	Delimiter getDelimiter() const {
		return delimiter;
	}

	void setDelimiter(Delimiter delimiter = LineEnd) {
		this->delimiter = delimiter;
	}

	DelimiterType getDelimiterType() const {
		return delimiterType;
	}

	void setDelimiterType(DelimiterType delimiterType = Postfix) {
		this->delimiterType = delimiterType;
	}

	const std::string& getExPattern() const {
		return exPattern;
	}

	void setExPattern(const std::string& exPattern = "*") {
		this->exPattern = exPattern;
	}

	FailureAction getFailureActon() const {
		return failureActon;
	}

	void setFailureActon(FailureAction failureActon = Backup) {
		this->failureActon = failureActon;
	}

	bool isIncludeLocalSubDir() const {
		return includeLocalSubDir;
	}

	void setIncludeLocalSubDir(bool ils = false) {
		this->includeLocalSubDir = includeLocalSubDir;
	}

	const std::string& getInputDirectory() const {
		return inputDirectory;
	}

	void setInputDirectory(const std::string& inputDirectory) {
		this->inputDirectory = inputDirectory;
	}

	int getLength() const {
		return length;
	}

	void setLength(int length = 80) {
		this->length = length;
	}

	int getLongRetry() const {
		return longRetry;
	}

	void setLongRetry(int longRetry = 0) {
		this->longRetry = longRetry;
	}

	const std::string& getPattern() const {
		return pattern;
	}

	void setPattern(const std::string& pattern = "*") {
		this->pattern = pattern;
	}

	int getPollingInerval() const {
		return pollingInerval;
	}

	void setPollingInerval(int pollingInerval = 5) {
		this->pollingInerval = pollingInerval;
	}

	RecordDetection getRecordDetection() const {
		return recordDetection;
	}

	void setRecordDetection(RecordDetection recordDetection = WholeFile) {
		this->recordDetection = recordDetection;
	}

	bool isReplaceArch() const {
		return replaceArch;
	}

	void setReplaceArch(bool replaceArch = false) {
		this->replaceArch = replaceArch;
	}

	Retry getRetry() const {
		return retry;
	}

	void setRetry(Retry retry = Failure) {
		this->retry = retry;
	}

	int getRetryTreshold() const {
		return retryTreshold;
	}

	void setRetryTreshold(int retryTreshold = 0) {
		this->retryTreshold = retryTreshold;
	}

	int getShortRetry() const {
		return shortRetry;
	}

	void setShortRetry(int shortRetry = 0) {
		this->shortRetry = shortRetry;
	}

	bool isSkipFirstRecord() const {
		return skipFirstRecord;
	}

	void setSkipFirstRecord(bool skipFirstRecord = false) {
		this->skipFirstRecord = skipFirstRecord;
	}

	SuccessAction getSuccessAction() const {
		return successAction;
	}

	void setSuccessAction(SuccessAction successAction = DeleteOnSuccess) {
		this->successAction = successAction;
	}

	bool isTransactionMode() const {
		return transactionMode;
	}

	void setTransactionMode(bool transactionMode = false) {
		this->transactionMode = transactionMode;
	}

private:
	//Description
	//Description description;

	//Basic
	std::string inputDirectory;
	bool includeLocalSubDir = false;		//Include local Subdirectoryies
	std::string pattern = ".*";				//File name or pattern
	std::string exPattern = "";			//File exclusion pattern
	SuccessAction successAction = DeleteOnSuccess;	//Action on successful processing
	bool replaceArch = false;				//Replace duplicate archive files

	//Input Message Parsing
	//InputMessageParsing inputMessageParsing;
	//Polling
	int pollingInerval = 5;					//Polling interval (seconds)

	//Retry
	Retry retry = Failure;
	int retryTreshold = 0;
	int shortRetry = 0;						//Short retry interval (seconds)
	int longRetry = 0;						//Long retry interval (second)
	FailureAction failureActon = Backup;	//Action on failing file

	//Records and Elements
	RecordDetection recordDetection = WholeFile;
	bool skipFirstRecord = false;
	int length = 80;						//Length (bytes)
	Delimiter delimiter = LineEnd;
	std::string customDelimiter;			//Custom delimiter (hexadecimal)
	DelimiterType delimiterType = Postfix;

	//Transactions
	bool transactionMode = false;

	//Instances
	AdditionalInstancesPool additionalInstancesPool = MessageFlow;
	int additionalInstances = 0;

};

FileInputNode::FileInputNode() {

}

FileInputNode::~FileInputNode() {
	// TODO Auto-generated destructor stub
}



} /* namespace inte */

#endif /* FILEINPUTNODE_H_ */
